<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>登录</title>
		<link rel="stylesheet" type="text/css" href="../easyUI/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../easyUI/themes/icon.css">
		<script type="text/javascript" src="../easyUI/jquery.min.js"></script>
		<script type="text/javascript" src="../easyUI/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../addressIP.js"></script>
	</head>
	<body style="text-align:center; background-color:#B7D2FF">
		<h2>实验室管理系统</h2>
		<p></p>
		<div style="margin:20px 0;"></div>
		<div style="margin: 0 auto;width:400px">
			<div class="easyui-panel" title="登录" style="width:100%;max-width:400px;padding:30px 60px;">
				<form id="ff" class="easyui-form" method="post" data-options="novalidate:true">
					<div style="margin-bottom:20px">
						<input id="inputAccount" class="easyui-textbox" prompt="账号:" name="userName" style="width:100%" data-options="label:'账号:',required:true">
					</div>
					<div style="margin-bottom:20px">
						<input id="inputPassword" class="easyui-passwordbox" prompt="密码:" name="password" style="width:100%" data-options="label:'密码:',required:true">
					</div>
				</form>
				<div style="text-align:center;padding:5px 0">
                    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitFormTeacher()" style="width:100px">教师登录</a>
					<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:100px">管理员登录</a>
				</div>
			</div>
		</div>

		<script>
            function submitFormTeacher(){
                var inforadd = addressip + "/login";
                $('#ff').form('submit', {
                    url: inforadd,
                    success:function(data){
                        if(data== '"teacher"'){
                            localStorage.setItem("superAccount",document.getElementById("inputAccount").value);
                            localStorage.setItem("password",document.getElementById("inputPassword").value)
                            location.href = "teacherHomePage.html";
                        }else{
                            $.messager.alert('系统信息', '登录失败，请检查账号密码是否匹配');
                        }
                    }
                });
            }
            function submitForm() {
				address = adminiip + "/login";
				$('#ff').form('submit', {
					url: address,
				    success:function(data){
						if(data=='"superLader"'){
                            localStorage.setItem("superAccount",document.getElementById("inputAccount").value);
                            localStorage.setItem("password",document.getElementById("inputPassword").value)
							location.href = "homePage.html";
						}else{
							$.messager.alert('系统信息', '登录失败，请检查账号密码是否匹配');
						}
				    }   
				}); 
			}
		</script>
	</body>
</html>
